<template>
	<view>
		<u-modal :show="show" :showConfirmButton="false" width="600rpx">
			<view class="my-modal-container">
				<view v-if="title" class="title">{{ title }}</view>
				<slot name="content">
					<view class="content" :style="contentStyle" v-if="content">{{ content }}</view>
				</slot>
				<view class="buttons f-c-between">
					<button v-if="showCancelButton" class="btn-item btn-cancel f-center" @click="cancelBtn">取消</button>
					<button class="btn-item f-center" @click="confirmBtn">{{confirmText}}</button>
				</view>
			</view>
		</u-modal>
	</view>
</template>

<script>
	export default {
		name: "Modal",
		props: {
			// 显示
			show: {
				type: Boolean,
				default: false,
			},

			// 显示取消按钮
			showCancelButton: {
				type: Boolean,
				default: true,
			},
			//确定按钮文案
			confirmText: {
				type: String,
				default: "确定",
			},
			// 标题
			title: {
				type: String,
				default: "",
			},
			// 内容
			content: {
				type: String,
				default: "",
			},
			contentStyle: {
				type: Object,
				default: () => ({}),
			},
		},
		data() {
			return {

			};
		},
		methods: {
			cancelBtn() {
				this.$emit('cancel')
			},

			confirmBtn() {
				this.$emit('confirm')
			}
		},
	}
</script>

<style lang="scss" scoped>
	/deep/.u-popup__content {
		border-radius: 16rpx !important;
	}

	.my-modal-container {
		width: 100%;

		.title {
			font-family: AppleSystemUIFont;
			font-size: 36rpx;
			color: #333333;
			text-align: center;
			margin-bottom: 42rpx;
		}

		.content {
			font-weight: 400;
			font-size: 32rpx;
			color: #676767;
			text-align: center;
		}

		.buttons {
			padding: 60rpx 20rpx 0;

			.btn-item {
				width: 220rpx;
				height: 70rpx;
				font-family: AppleSystemUIFont;
				font-size: 34rpx;
				color: #FFFFFF;
				background: #FFC046;
				border-radius: 35rpx;
				border: 1px solid #FFC046;
			}

			.btn-cancel {
				background-color: #FFFFFF;
				color: #FFC046;
			}
		}
	}
</style>